package com.module.codeBind.schedule;

import java.util.HashMap;
import java.util.Map;
import java.util.TimerTask;

import org.apache.log4j.Logger;

import com.module.codeBind.manager.BatchCodeManager;

public class OpenBatchCode extends TimerTask {
	private static Logger logger = Logger.getLogger(OpenBatchCode.class);
	private static  int optnum =0;

	@Override
	public void run() {		
		Map<String,Object> map = new HashMap<String,Object>();
		boolean isTrue = false;
  	    try {
  	    	BatchCodeManager batchCodeManager =BatchCodeManager.getInstance();
  	    	map = batchCodeManager.openBatchByTime();
		} catch (Exception e) {
			if(optnum != 0){
				e.printStackTrace();
				logger.error("定时开启批次错误："+e.getMessage());
			}		
		}finally{
			if(!isTrue && optnum != 0)
				logger.error("定时开启批次失败！");
			else if(isTrue)
				logger.error("定时开启批次成功！");
			optnum ++;
		}
		
	}

}
